package com.ganmiao.server.supplier.service;

import com.ganmiao.server.supplier.entity.Product;
import com.ganmiao.server.supplier.entity.Supplier;
import com.ganmiao.server.supplier.entity.Tender;
import com.ganmiao.server.supplier.mapper.ProductMapper;

import java.util.List;

public class ProductService {

    private ProductMapper productMapper;

    public Product productGet(Integer id) {
        Product product = productMapper.productGet(id);
        return product;
    }

    public List<Product> getAllProducts() {
        return productMapper.getAllProducts();
    }

    public Integer productCreate(Product product) {
        int rowsAffected = productMapper.productCreate(product);
        return rowsAffected;
    }

    public void productUpdate(Integer id, Product product) {
        productMapper.productUpdate(id, product.getName(), product.getDetails());
    }

    public void productDelete(Integer id) {
        productMapper.productDelete(id);
    }
}
